<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>注册本地类前缀</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="yaf-loader.islocalname.html">« Yaf_Loader::isLocalName</a></li>
      <li style="float: right;"><a href="yaf-loader.registernamespace.html">Yaf_Loader::registerNamespace »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.yaf-loader.html">Yaf_Loader</a></li>
    <li>注册本地类前缀</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="yaf-loader.registerlocalnamespace" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Yaf_Loader::registerLocalNamespace</h1>
  <p class="verinfo">(Yaf &gt;=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Loader::registerLocalNamespace</span> &mdash; <span class="dc-title">注册本地类前缀</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-yaf-loader.registerlocalnamespace-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>Yaf_Loader::registerLocalNamespace</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$prefix</code><span class="initializer"> = ?</span></span>): <span class="type"><span class="type void">void</span></span></div>

  <p class="para rdfs-comment">
   register local class prefix
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-yaf-loader.registerlocalnamespace-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>
<code class="parameter">prefix</code></dt>

    <dd>

     <p class="para">
      字符串或者是数组格式的类名前缀，所有拥有和这些前缀相同前缀的类将被加载到本地library路径。
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-yaf-loader.registerlocalnamespace-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   bool
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-yaf-loader.registerlocalnamespace-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-3909">
   <p><strong>示例 #1 <span class="function"><strong>Yaf_Loader::registerLocalNamespace()</strong></span>example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$loader&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Yaf_Loader</span><span style="color: #007700">::</span><span style="color: #0000BB">getInstance</span><span style="color: #007700">(</span><span style="color: #DD0000">'/local/library/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'/global/library'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">registerLocalNamespace</span><span style="color: #007700">(</span><span style="color: #DD0000">"Baidu"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">registerLocalNamespace</span><span style="color: #007700">(array(</span><span style="color: #DD0000">"Sina"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Weibo"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">autoload</span><span style="color: #007700">(</span><span style="color: #DD0000">"Baidu_Name"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//&nbsp;search&nbsp;in&nbsp;'/local/library/'<br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">autoload</span><span style="color: #007700">(</span><span style="color: #DD0000">"Sina"</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;search&nbsp;'/local/library/'<br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">autoload</span><span style="color: #007700">(</span><span style="color: #DD0000">"Global_Name"</span><span style="color: #007700">);</span><span style="color: #FF8000">//&nbsp;search&nbsp;in&nbsp;'/global/library/'<br /></span><span style="color: #0000BB">$loader</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">autoload</span><span style="color: #007700">(</span><span style="color: #DD0000">"Foo_Bar"</span><span style="color: #007700">);&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;search&nbsp;in&nbsp;'/global/library/'<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


</div></div></div></body></html>